<!--
  模块：一键求助 - 分配审核 - 审核
-->
<template>
  <div class="help-review-add">
    <!-- 一键求助 - 分配审核 - 审核 -->
    <!-- 头部 -->
      <div class="header">
          <el-button type="primary" @click="to_fall_back">退回分配</el-button>
          <el-button type="primary" @click="pass">审核通过</el-button>
      </div>


    <!-- 内容 -->
      <div class="content">
          <el-row :gutter="20">
          <el-form label-position="top" :model="formParams" >
            <el-col :span="12" class="contents">
              <div class="left">

                  <CardFormTitle title="企业信息"></CardFormTitle>

                  <CardFormContent>

                    <el-form-item prop="companyName" label="企业名称">
                        <el-input
                            v-model="formParams.companyName"
                            clearable
                            disabled
                          />
                    </el-form-item>

                    <el-col :span="12">
                      <el-form-item prop="companyName" label="社会信用代码">
                          <el-input
                              v-model="formParams.creditCode"
                              clearable
                              disabled
                          />
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item prop="companyName" label="企业分类">
                          <el-input
                              v-model="formParams.companyType.desc"
                              clearable
                              disabled
                          />
                      </el-form-item>
                    </el-col>
                  </CardFormContent>

                  <div>
                  <CardFormTitle title="问题述求"></CardFormTitle>
                  </div>

                  <CardFormContent>



                  <el-col :span="12">
                    <el-form-item prop="companyName" label="求助类型">
                        <el-input
                            v-model="formParams.helpType.desc"
                            clearable
                            disabled
                          />
                    </el-form-item>
                  </el-col>

                  <el-col :span="12">
                    <el-form-item prop="companyName" label="求助时间">
                        <el-input
                            v-model="formParams.helpTime"
                            clearable
                            disabled
                          />
                    </el-form-item>
                  </el-col>

                  <el-col :span="24">
                    <el-form-item prop="companyName" label="问题和述求描述">
                        <el-input
                            v-model="formParams.queDes"
                            clearable
                            type="textarea"
                            maxlength="1000"
                            show-word-limit
                            disabled
                          />
                    </el-form-item>
                  </el-col>
                  </CardFormContent>


              </div>
            </el-col>
            <el-col :span="12" class="contents" >
              <div class="right" style="text-align:left">
                <CardFormTitle title="分配部门"></CardFormTitle>
                <div class="right-content">
                <CardFormContent>
                    <el-col :span="12">
                    <el-form-item prop="companyName" label="选择部门">
                        <el-select
                            v-model="formParams.assignDeptId"
                            disabled
                        >
                            <el-option
                                  v-for="dict in selectdept"
                                  :key="dict.id"
                                  :label="dict.name"
                                  :value="dict.id"
                            />
                        </el-select>
                    </el-form-item>
                    </el-col>

                </CardFormContent>
                </div>
                <CardFormTitle title="反馈信息"></CardFormTitle>
              </div>
            </el-col>
          </el-form>
          </el-row>
      </div>

    <!-- 退回会话框 -->
    <el-dialog
        title="确认将此条记录退回分配列表"
         width="30%"
        :visible.sync="backeswitch"
        :before-close="cancel"

    >
        <el-input
             type="textarea"
             :rows="4"
             placeholder="请输入内容"
              v-model="textarea"
              maxlength="1000"
        ></el-input>
         <span slot="footer" class="dialog-footer">
            <el-button @click="cancel">取 消</el-button>
            <el-button type="primary" @click="goback">确 定</el-button>
         </span>
    </el-dialog>

    <!-- 通过会话框 -->
    <el-dialog
        title=" "
        width="25%"
        :visible.sync="pustswitch"

      >
      <span>确认无误通过审核</span>
          <span slot="footer" class="dialog-footer">
            <el-button @click="pustswitch = false">取 消</el-button>
            <el-button type="primary" @click="gopust">确 定</el-button>
          </span>
    </el-dialog>


  </div>
</template>

<script>
    // 样式
  import CardFormContent from "@/components/card-form-content"
  // 样式
  import CardFormTitle from "@/components/card-form-title"
  // 详情数据请求
  import { detailsdata,Allocateaudit } from '@/api/help/review'


export default {
  name: 'HelpReviewAdd',

   components:{
    CardFormContent,
    CardFormTitle
  },

    created(){
      this.details();
  },


  data(){
    return {
      // 返回内容
      textarea:undefined,

      // 数据ID
      detectionid:undefined,

      // 详情信息
        formParams:{},

      // 部门数据
        selectdept:{},

      // 返回
      backeswitch:false,

      // 通过
      pustswitch:false,

      // 审核数据
      pustdata:{
        id :this.$route.query.id,
        examineUserId : this.$store.getters.userInfo.roleId,
        examineUserName : this.$store.getters.userInfo.userName,
        examineOpinion : undefined,
        examineResult : undefined
      }
    }

  },
  methods:{
      // 获取详情数据
      details(){
          detailsdata(this.$route.query.id).then((respone)=>{
              this.detectionid = this.$route.query.id
              this.formParams = { ...respone.data.btHelpAssignDetailsVO }
              this.selectdept = { ...respone.data.selectdept }

          })
      },

      // 退回
      to_fall_back(){
          this.backeswitch = true;
      },

      // 通过
      pass(){
          this.pustswitch = true;
      },

      // 取消
      cancel(){
          this.backeswitch = false;
          this.textarea = undefined;
      },

      // 退回发往后台
      goback(){

        let data = this.pustdata

        data.examineOpinion = this.textarea

        data.examineResult = 0

        Allocateaudit(data).then((respone) => {
              this.$router.push({
                 name:"HelpReview"
                  })
          window.location.reload()
        })

      },

      // 通过
      gopust(){

        let data = this.pustdata

        data.examineOpinion = undefined

        data.examineResult = 1

        Allocateaudit(data).then((respone) =>{
            this.$router.push({
                 name:"HelpReview"
                  })
           window.location.reload()
        })


      },


  },
}
</script>

<style lang="scss" scoped>
  .header{
    width: 100%;
    padding: 10px;
    padding-right: 20px;
    background-color: white;
    text-align: right;
  }


  .content {
    width: 100%;
    height: 700px;
    padding-top: 24px;
    padding-left: 48px;
    padding-right: 48px;

    & .contents{
    border:20px solid rgb(226, 232, 240);
    height: 623px;
    background-color: rgb(255, 255, 255);
    text-align: left;
  }

  }


  .left{
    text-align: left;
  }

  .card-form-title{
    margin-top: 40px;
    padding-left: 10px;

  }

  .card-form-content{
      height:165px;
      width: 60%;
      margin-left: 20px;
  }

  .right-content{
    height: 210px;
  }




</style>
